<template>
  <div>
    <nav-header
      :headerTitle="'100元现金券'"
      :headerNext="'邀请记录'"
      :navBgColor="'#fff'"
      @tap2next="tabNext"
    ></nav-header>
    <!-- <div class="loading" v-show="isLoading">
      <img src="@/assets/images/loading.gif" alt />
    </div> -->
    <section class="page" v-show="!isLoading">
      <div class="p-header" v-if="show.list.length>0">
        <div class="task"></div>
        <van-swipe :autoplay="3000" :show-indicators="false" vertical v-if="!isLoading">
          <van-swipe-item v-for="(items,index) in show.list" :key="index">
            <div class="ph-items">
              <img :src="items.avatarUrl" alt />
              <div>{{items.nickName}}</div>
              <span>提现{{items.amount}}元现金</span>
            </div>
            <div class="clear"></div>
          </van-swipe-item>
        </van-swipe>
      </div>
      <img class="p-img" src="@/assets/images/home_money_bg.png" alt />
      <div class="content">
        <div class="header">
          <span class="spanOne">100</span>
          <span class="spanTwo">元</span>
          <span class="spanThree">邀请一位好友开通会员奖金立即到账</span>
          <div class="divOne">
            <div class="content">
              <span>可提现</span>
              <img src="@/assets/images/home_money_withdraw.png" alt />
            </div>
          </div>
        </div>
        <div class="section">
          <div class="items">
            <img class="imgOne" src="@/assets/images/home_money_title_right.png" alt />
            <img class="imgTwo" src="@/assets/images/home_money_title_left.png" alt />
            <div class="divOne">
              <div class="content">
                <img src="@/assets/images/home_money_icon2@2x.png" class="imgThree" alt />
                <span class="do-spanOne">{{show.amountArray[2]/100}}</span>
                <span class="do-spanTwo">奖励</span>
              </div>
            </div>
            <span class="spanOne">{{show.amountArray[2]/100}}元提成奖励</span>
            <span class="span spanTwo">
              好友开通精英会员您得
              <span class="cred">{{show.amountArray[0]/100}}</span>元
            </span>
            <span class="span spanThree">
              好友开通高管会员您得
              <span class="cred">{{show.amountArray[1]/100}}</span>元
            </span>
            <span class="span spanFour">
              好友开通老板会员您得
              <span class="cred">{{show.amountArray[2]/100}}</span>元
            </span>
          </div>
          <div class="null32"></div>
          <div class="items">
            <img class="imgOne" src="@/assets/images/home_money_title_right.png" alt />
            <img class="imgTwo" src="@/assets/images/home_money_title_left.png" alt />
            <div class="divOne">
              <div class="content">
                <img src="@/assets/images/home_money_icon2@2x.png" class="imgThree" alt />
                <span class="do-spanOne">
                  {{show.royalty}}
                  <span>%</span>
                </span>
                <span class="do-spanTwo">提成</span>
              </div>
            </div>
            <span class="spanOne">躺着赚钱</span>
            <span class="span spanTwo">好友消耗广告费，您最高可得</span>
            <span class="span spanThree">{{show.royalty}}%提成。提成永久有效</span>
          </div>
          <div class="null32"></div>
          <div class="s-careful">注：奖金可以提现，也可以作为广告费使用</div>
          <div class="null32"></div>
        </div>
        <div class="footer" @click.stop="inviteFris">邀请好友解锁</div>
      </div>
    </section>
  </div>
</template>

<script>
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
Vue.use(Swipe).use(SwipeItem);
import navHeader from "@/components/NavHeader";
import mixin from "@/utils/mixin";
import bonuselist from "@/utils/bonuse100List"
console.log(bonuselist)
export default {
  name: "bonuses100",
  mixins: [mixin],
  components: {
    navHeader
  },
  data() {
    return {
      isLoading: false,
      show: {
        list: bonuselist.copyList,
        amountArray: [29900, 49900, 99900],
        royalty:30
      }
    };
  },
  created() {},
  mounted() {
    this.$setgoindex() ;
    this.init();
  },
  methods: {
    init() {
      this.params = {};
      this.$http.post("user/getWithdrawList", this.params).then(
        res => {
          console.log(res);
          // this.show.list = res.data.withdrawList;
          this.show.amountArray = res.data.amountArray;
          if(res.data.maxAdExpenseProportion){
            this.show.royalty = res.data.maxAdExpenseProportion;
          }
          // let time = setTimeout(() => {
          //   this.isLoading = false;
          //   clearTimeout(time);
          // }, 800);
        },
        err => {
          console.log(err);
        }
      );
    },
    // 邀请记录
    tabNext: function() { 
      let parmas = {};
      this.$bridge.callHandler("invitationRecord", parmas, res => {
        console.log(res); 
      });
    },
    // 邀请好友
    inviteFris(){
      this.$bridge.callHandler("inviteFriends",  {}, res => {
        console.log(res); 
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.null32 {
  width: 100%;
  height: 32px;
}
.null78 {
  width: 100%;
  height: 78px;
}
.page {
  //   margin-top: 86px;
  position: absolute;
  left: 0px;
  right: 0px;
  top: 86px;
  bottom: 0px;
  background: #ff2525;
  .p-header {
    width: 100%;
    height: 68px;
    position: fixed;
    top: 86px;
    left: 0px;
    z-index: 200;
    .van-swipe {
      width: 100%;
      height: 100%;
    }
    .task {
      position: absolute;
      width: 100%;
      height: 100%;
      opacity: 0.3;
      background: #000000;
    }
    .ph-items {
      width: 100%;
      height: 68px;
      // line-height: 68px;
      img {
        width: 44px;
        height: 44px;
        border-radius: 50%;

        float: left;
        margin-left: 164px;
        margin-top: 12px;
      }
      div {
        font-family: PingFangSC-Regular;
        font-size: 28px;
        color: #ffffff;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        max-width: 100px;

        float: left;
        margin-left: 16px;
        margin-top: 14px;
      }
      span {
        font-family: PingFangSC-Regular;
        font-size: 28px;
        color: #ffffff;
        text-align: left;
        float: left;
        margin-left: 8px;
        margin-top: 14px;
      }
    }
  }
  .p-img {
    width: 100%;
    height: 1448px;
    position: absolute;
    left: 0px;
    top: 0px;
  }
  .content {
    width: 100%;
    height: 100%;
    position: relative;
    .header {
      .spanOne {
        font-size: 128px;
        font-family: PingFangSC-Semibold;
        font-weight: 600;
        color: rgba(255, 37, 37, 1);
        position: absolute;
        left: 219px;
        top: 157px;
      }
      .spanTwo {
        font-size: 48px;
        font-family: PingFangSC-Semibold;
        font-weight: 600;
        color: rgba(255, 37, 37, 1);
        position: absolute;
        left: 462px;
        top: 228px;
      }
      .spanThree {
        font-size: 32px;
        font-family: PingFangSC-Regular;
        font-weight: 400;
        color: rgba(255, 37, 37, 1);
        position: absolute;
        left: 151px;
        top: 348px;
      }
      .divOne {
        width: 88px;
        height: 40px;
        position: absolute;
        left: 462px;
        top: 192px;
        .content {
          width: 100%;
          height: 100%;
          position: relative;
        }
        img {
          width: 100%;
          height: 100%;
          position: absolute;
          left: 0px;
          top: 0px;
        }
        span {
          font-size: 24px;
          font-family: PingFangSC-Regular;
          font-weight: 400;
          color: rgba(255, 37, 37, 1);
          position: absolute;
          left: 50%;
          top: 50%;
          margin-left: -36px;
          margin-top: -16px;
          z-index: 200;
        }
      }
    }
    .section {
      position: absolute;
      left: 0px;
      right: 0px;
      top: 530px;
      height: 918px;
      .items {
        width: 686px;
        margin: auto;
        height: 342px;
        background: #ffffff;
        border-radius: 24px;
        position: relative;
        .imgOne {
          width: 29px;
          height: 35px;
          position: absolute;
          left: 159px;
          top: 51px;
        }
        .imgTwo {
          width: 29px;
          height: 35px;
          position: absolute;
          right: 159px;
          top: 51px;
        }
        .cred {
          color: #ff2525;
        }
        .spanOne {
          font-family: PingFangSC-Semibold;
          font-size: 34px;
          color: #ff2525;
          position: absolute;
          width: 100%;
          text-align: center;
          top: 48px;
          font-weight: bold;
        }
        .span {
          font-size: 30px;
          font-family: PingFangSC-Regular;
          font-weight: 400;
          color: rgba(48, 49, 51, 1);
          position: absolute;
          left: 238px;
        }
        .spanTwo {
          top: 160px;
        }
        .spanThree {
          top: 205px;
        }
        .spanFour {
          top: 250px;
        }
        .divOne {
          width: 158px;
          height: 192px;
          position: absolute;
          left: 48px;
          top: 150px;
          .content {
            width: 100%;
            height: 100%;
            position: relative;
          }
          .do-spanOne {
            font-family: PingFangSC-Semibold;
            font-size: 48px;
            color: #e30b1b;
            position: absolute;
            width: 100%;
            text-align: center;
            top: 16px;
            span {
              font-size: 20px;
              margin-left: -10px;
            }
          }
          .do-spanTwo {
            font-family: PingFangSC-Regular;
            font-size: 24px;
            color: #fcd29e;
            position: absolute;
            width: 100%;
            text-align: center;
            bottom: 60px;
          }
          img {
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0px;
            top: 0px;
          }
        }
      }
      .s-careful {
        width: 100%;
        text-align: center;
        font-family: PingFangSC-Regular;
        font-size: 28px;
        color: #ffffff;
      }
    }
    .footer {
      width: 100%;
      height: 100px;
      line-height: 100px;
      text-align: center;
      background: rgba(255, 198, 1, 1);
      font-size: 34px;
      font-family: PingFangSC-Regular;
      font-weight: 400;
      color: rgba(255, 37, 37, 1);
      position: fixed;
      bottom: 0px;
      left: 0px;
    }
  }
  .null32 {
    width: 100%;
    height: 32px;
  }
}
</style>
